/**
 * 2025/01/01 - 2025/12/31
 */
package com.snail.server.database.engine.ddl.table.mapping;

import com.snail.server.database.engine.ddl.table.dto.TableCreateDTO;
import com.snail.server.database.engine.ddl.table.entity.Table;
import com.snail.server.database.engine.ddl.table.vo.TableVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;

/**
 *
 * @author zgadmin
 * @date 2025/9/9 14:53
 *
 */
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING)
public interface TableMapping {

    @Mapping(target = "status", expression = "java(com.snail.starter.db.enums.EnableOrDisEnableEnum.ENABLE)")
    Table tableCreateDTO2Table(TableCreateDTO tableCreateDTO);

    @Mapping(target = "status", expression = "java(table.getStatus().getValue())")
    TableVO toTableVO(Table table);

}